#ifndef _INC_MEMPAGE_H_
#define _INC_MEMPAGE_H_

class memPage_t
{
public:
	// Ctor
	memPage_t(size_t size);

	// Dtor
	~memPage_t();
	
	// Returns page current position
	size_t getPosition() const;

	// Sets page current position, returns true if successful, false otherwise
	bool setPosition(size_t pos);
	
	// Returns page size
	size_t getPageSize() const;

	// Returns page actual size
	size_t getActualSize() const;

	// Returns page free size
	size_t getFreeSize() const;

	// Returns true if page is empty, false otherwise
	bool isPageEmpty() const;

	// Returns true if page is full, false otherwise
	bool isPageFull() const;
	
	// Attempts to read data from page according to given parameters
	void read(void* const data, size_t size);

	// Attempts to read data from page according to given parameters
	void read(void* const data, size_t size, size_t position);
	
	// Attempts to write data to page according to parameters
	void write(const void* const data, size_t size, size_t offset);
	
	// Sets next page
	void setNext(memPage_t* const page);

	// Sets previous page
	void setPrev(memPage_t* const page);

	// Returns next page
	memPage_t* getNext() const;

private:
	// Copy Ctor
	memPage_t(const memPage_t& mp);

	// Operator=
	memPage_t& operator=(const memPage_t& mp);

	size_t pageSize;
	size_t actualSize;
	size_t position;
	char* pageData;

	memPage_t* next;
	memPage_t* prev;
};

#endif // _INC_MEMPAGE_H_